<?php

namespace app\admin\config\user;
use app\common\model\AdminUser as DataMode;
class Info
{
    public function Model()
    {
        return new DataMode();
    }

    public function ListModel()
    {
        $Model=new DataMode();
        $DB=$Model->alias('a');
        return $DB;
    }

    public function InfoMode()
    {
        $data=[
            'app_id'=>'5',
            'app_num'=>'admin',
            'app_name'=>'后台管理',
            'mode_id'=>'9',
            'mode_num'=>'user',
            'mode_name'=>'后台用户',
            'database'=>'admin_user',
            'sub_database'=>[],        ];
        return $data;
    }

    public function InfoForm()
    {
        $data=[
            'power_field'=>[],
            'layout'=>[
                [
                    'field'=>'user',
                    'title'=>'账号',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'1',
                    'required'=>'1',
                    'verify'=>'isalpha',
                ],
                [
                    'field'=>'name',
                    'title'=>'姓名',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'ischs',
                ],
                [
                    'field'=>'phone',
                    'title'=>'手机号',
                    'value'=>'',
                    'tag'=>'phone',
                    'only'=>'1',
                    'required'=>'1',
                    'verify'=>'isphone',
                ],
                [
                    'field'=>'upass',
                    'title'=>'密码',
                    'value'=>'',
                    'tag'=>'password',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                ],
                [
                    'field'=>'path_id',
                    'title'=>'我的上级',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'admin_user_list',
                ],
                [
                    'field'=>'role_ids',
                    'title'=>'所属角色',
                    'value'=>'',
                    'tag'=>'tree',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'admin_role',
                ],
                [
                    'field'=>'department_ids',
                    'title'=>'所属组织',
                    'value'=>'',
                    'tag'=>'tree',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'department_list',
                ],
                [
                    'field'=>'notes',
                    'title'=>'备注',
                    'value'=>'',
                    'tag'=>'textarea',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
            ],
        ];
        return $data;
    }

    public function InfoLists()
    {
        $data=[
            'lists'=>[
                [
                    'name'=>'全部',
                    'num'=>'m_20240417222414',
                    'page_num'=>'30',
                    'order_raw'=>'id desc',
                    'power_field'=>[],
                    'power_role'=>'',
                    'power_department'=>'',
                    'set_where'=>'',
                    'table_cols'=>[
                [
                    'field'=>'id',
                    'title'=>'主键',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'user',
                    'title'=>'账号',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'name',
                    'title'=>'姓名',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'phone',
                    'title'=>'手机号',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'role_ids',
                    'title'=>'所属角色',
                    'update'=>'',
                    'options'=>'admin_role',
                    'search'=>'select',
                    'total'=>'2',
                ],
                [
                    'field'=>'department_ids',
                    'title'=>'所属组织',
                    'update'=>'',
                    'options'=>'department_list',
                    'search'=>'select',
                    'total'=>'2',
                ],
                [
                    'field'=>'is_super',
                    'title'=>'超级管理员',
                    'update'=>'switch',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'status',
                    'title'=>'是否启用',
                    'update'=>'switch',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'create_time',
                    'title'=>'新增时间',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
            ],

                ],
            ],
        ];
        return !empty($data['lists']) ? $data['lists'] : [];
    }

}